package com.junjiao.util.java;

import java.awt.Dimension;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * 商家空间环境部署信息
 * 
 * @author jiaojun
 * @email eshore_jiaojun@163.com
 * @version 2.0
 * @date 2010-5-10
 */
public class DeployInfo {
	private final static Log log = LogFactory.getLog(DeployInfo.class);
	private String indexTourLine;
	private String indexTourLineUpload;
	private String indexTourLineServer;
	private String imgHttpServerHost;
	private String mapAppServerHost;
	private String flashStreamServerHost;
	private String videoUploadServerPath;
	private String uploadImgPath;
	private String indexFilePath;
	private String dataBaseJdbcUrl;

	private String emailProperty;
	private String emailParam;
	private String imgSizeType;
	private String pageBasePath;
	private String sysLogoImgPath;
	private String sysBgImgPath;
	private String ip2City;// 城市切换

	private String personLoginAddress;
	private String corpLoginAddress;
	private String backendLoginAddress;

	private String houseLinkPage;

	private String personLogout;// 个人退出

	private String corpLogout;// 商家退出

	private String adJsUrl;// 广告JS URL

	private String weatherHttpAddress;// 天气接口

	private String keywordUrl;// 过滤关键字

	private String jifenUrl;// 积分管理URL

	private String dingCanUrl;// 定餐

	private String besttoneSpId;// 商旅卡spId,统一认证号。

	private String statInterfaceUrl; // 信息审核量统计报表中接口

	private String domainName;// 不能注册的商家空间的二级域名
	// 找不到图片
	private String noFindImagePath;

	// 水印图片
	private List<String> sysLogoImgList = new ArrayList<String>();
	// 图标
	private List<String> sysBgImgList = new ArrayList<String>();
	// 图片大小
	private Map<String, Object> imgTypeMap = new HashMap<String, Object>();
	// 邮件参数
	private ArrayList<Object> emailList = new ArrayList<Object>();
	private HashMap<String, Object> emailMap = new HashMap<String, Object>();

	private String htmlSourceUrl;
	private String htmlResultUrl;
	private String deployApp;

	private String memcacheServer;// memcache服务器地址
	private String maxLimitIpNum;// 最大限制搜索数

	private String backendUrl;// 后台连接
	// 客户信息平台链接
	private String customerInfoUrl;// 客户信息平台 基础资料
	private String passwordUrl;// 客户信息平台 密码修改

	/**
	 * @return the backendUrl
	 */
	public String getBackendUrl() {
		return backendUrl;
	}

	/**
	 * @param backendUrl
	 *            the backendUrl to set
	 */
	public void setBackendUrl(String backendUrl) {
		this.backendUrl = backendUrl;
	}

	public String getMemcacheServer() {
		return memcacheServer;
	}

	public void setMemcacheServer(String memcacheServer) {
		this.memcacheServer = memcacheServer;
	}

	public String getMaxLimitIpNum() {
		return maxLimitIpNum;
	}

	public void setMaxLimitIpNum(String maxLimitIpNum) {
		this.maxLimitIpNum = maxLimitIpNum;
	}

	public String getDeployApp() {
		return deployApp;
	}

	public void setDeployApp(String deployApp) {
		this.deployApp = deployApp;
	}

	public String getHtmlResultUrl() {
		return htmlResultUrl;
	}

	public void setHtmlResultUrl(String htmlResultUrl) {
		this.htmlResultUrl = htmlResultUrl;
	}

	public String getHtmlSourceUrl() {
		return htmlSourceUrl;
	}

	public void setHtmlSourceUrl(String htmlSourceUrl) {
		this.htmlSourceUrl = htmlSourceUrl;
	}

	public void echoDeployInfo() {
		InetAddress addr;
		try {
			log.info("WEB114 WebSite（集团网百生活导航频道）部署信息：");
			addr = InetAddress.getLocalHost();
			log.info("Web应用服务器主机->" + addr.getHostName() + ":"
					+ addr.getHostAddress());
			log.info("数据库服务器URL->" + dataBaseJdbcUrl);
			// log.info("地图应用服务器主机（集群）->"+mapAppServerHost);
			log.info("图片HTTP服务器主机（集群）->" + imgHttpServerHost);
			// log.info("流媒体转换&播放应用主机->"+flashStreamServerHost);
			// log.info("视频上传转换管理Web路径->"+videoUploadServerPath);
			log.info("图片上传位置->" + uploadImgPath);
			log.info("索引存放位置->" + indexFilePath);

		} catch (UnknownHostException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

	public String getImgHttpServerHost() {
		return imgHttpServerHost;
	}

	public void setImgHttpServerHost(String imgHttpServerHost) {
		this.imgHttpServerHost = imgHttpServerHost;
	}

	public String getUploadImgPath() {
		return uploadImgPath;
	}

	public void setUploadImgPath(String uploadImgPath) {
		this.uploadImgPath = uploadImgPath;
	}

	public String getImgSizeType() {
		return imgSizeType;
	}

	public void setImgSizeType(String imgSizeType) {
		String[] imgArray = imgSizeType.trim().split("[:]");
		String[] imgValue = null;
		String[] widthHeigth = null;
		for (int i = 0; i < imgArray.length; i++) {
			imgValue = imgArray[i].trim().split("[,]");
			widthHeigth = imgValue[1].split("[*]");
			imgTypeMap.put(imgValue[0],
					new Dimension(Integer.parseInt(widthHeigth[0]), Integer
							.parseInt(widthHeigth[1])));
		}
		// ZoomImage.setImgTypes(imgTypeMap);
		this.imgSizeType = imgSizeType;
	}

	public Map<String, Object> getImgTypeMap() {
		return imgTypeMap;
	}

	public void setImgTypeMap(Map<String, Object> imgTypeMap) {
		this.imgTypeMap = imgTypeMap;
	}

	public String getPageBasePath() {
		return pageBasePath;
	}

	public void setPageBasePath(String pageBasePath) {
		this.pageBasePath = pageBasePath;
	}

	public List<String> getSysBgImgList() {
		return sysBgImgList;
	}

	public void setSysBgImgList(List<String> sysBgImgList) {
		this.sysBgImgList = sysBgImgList;
	}

	public String getSysBgImgPath() {
		return sysBgImgPath;
	}

	public void setSysBgImgPath(String sysBgImgPath) {
		String[] imgPath = sysBgImgPath.trim().split("[,]");
		for (int i = 0; i < imgPath.length; i++) {
			if (!imgPath[i].equals(""))
				sysBgImgList.add(imgPath[i]);
		}
		this.sysBgImgPath = sysBgImgPath;
	}

	public List<String> getSysLogoImgList() {
		return sysLogoImgList;
	}

	public void setSysLogoImgList(List<String> sysLogoImgList) {
		this.sysLogoImgList = sysLogoImgList;
	}

	public String getSysLogoImgPath() {
		return sysLogoImgPath;
	}

	public void setSysLogoImgPath(String sysLogoImgPath) {
		String[] imgPath = sysLogoImgPath.trim().split("[,]");
		for (int i = 0; i < imgPath.length; i++) {
			sysLogoImgList.add(imgPath[i]);
		}
		this.sysLogoImgPath = sysLogoImgPath;
	}

	public String getMapAppServerHost() {
		return mapAppServerHost;
	}

	public void setMapAppServerHost(String mapAppServerHost) {
		this.mapAppServerHost = mapAppServerHost;
	}

	public String getNoFindImagePath() {
		return noFindImagePath;
	}

	public void setNoFindImagePath(String noFindImagePath) {
		this.noFindImagePath = noFindImagePath;
	}

	public String getFlashStreamServerHost() {
		return flashStreamServerHost;
	}

	public void setFlashStreamServerHost(String flashStreamServerHost) {
		this.flashStreamServerHost = flashStreamServerHost;
	}

	public String getVideoUploadServerPath() {
		return videoUploadServerPath;
	}

	public void setVideoUploadServerPath(String videoUploadServerPath) {
		this.videoUploadServerPath = videoUploadServerPath;
	}

	public String getIndexFilePath() {
		return indexFilePath;
	}

	public void setIndexFilePath(String indexFilePath) {
		this.indexFilePath = indexFilePath;
	}

	public String getDataBaseJdbcUrl() {
		return dataBaseJdbcUrl;
	}

	public void setDataBaseJdbcUrl(String dataBaseJdbcUrl) {
		this.dataBaseJdbcUrl = dataBaseJdbcUrl;
	}

	public ArrayList<Object> getEmailList() {
		return emailList;
	}

	public String getEmailParam() {
		return emailParam;
	}

	public void setEmailParam(String emailParam) {
		String[] param = emailParam.split(",");
		String[] keyValue = null;
		for (int i = 0; i < param.length; i++) {
			keyValue = param[i].split("=");
			emailMap.put(keyValue[0], keyValue[1]);
		}
		this.emailParam = emailParam;
		emailList.add(emailMap);
	}

	public String getEmailProperty() {
		return emailProperty;
	}

	public void setEmailProperty(String emailProperty) {
		String[] property = emailProperty.split(",");
		String[] keyValue = null;
		Properties props = new Properties();
		for (int i = 0; i < property.length; i++) {
			keyValue = property[i].split("=");
			props.put(keyValue[0], keyValue[1]);
		}
		emailMap.put("mailProps", props);
		this.emailProperty = emailProperty;
		emailList.add(emailMap);
	}

	public String getIp2City() {
		return ip2City;
	}

	public void setIp2City(String ip2City) {
		this.ip2City = ip2City;
	}

	public String getPersonLoginAddress() {
		return personLoginAddress;
	}

	public void setPersonLoginAddress(String personLoginAddress) {
		this.personLoginAddress = personLoginAddress;
	}

	public String getCorpLoginAddress() {
		return corpLoginAddress;
	}

	public void setCorpLoginAddress(String corpLoginAddress) {
		this.corpLoginAddress = corpLoginAddress;
	}

	public String getBackendLoginAddress() {
		return backendLoginAddress;
	}

	public void setBackendLoginAddress(String backendLoginAddress) {
		this.backendLoginAddress = backendLoginAddress;
	}

	public String getHouseLinkPage() {
		return houseLinkPage;
	}

	public void setHouseLinkPage(String houseLinkPage) {
		this.houseLinkPage = houseLinkPage;
	}

	public String getCorpLogout() {
		return corpLogout;
	}

	public void setCorpLogout(String corpLogout) {
		this.corpLogout = corpLogout;
	}

	public String getPersonLogout() {
		return personLogout;
	}

	public void setPersonLogout(String personLogout) {
		this.personLogout = personLogout;
	}

	public String getAdJsUrl() {
		return adJsUrl;
	}

	public void setAdJsUrl(String adJsUrl) {
		this.adJsUrl = adJsUrl;
	}

	public String getWeatherHttpAddress() {
		return weatherHttpAddress;
	}

	public void setWeatherHttpAddress(String weatherHttpAddress) {
		this.weatherHttpAddress = weatherHttpAddress;
	}

	public String getKeywordUrl() {
		return keywordUrl;
	}

	public void setKeywordUrl(String keywordUrl) {
		this.keywordUrl = keywordUrl;
	}

	public String getStatInterfaceUrl() {
		return statInterfaceUrl;
	}

	public void setStatInterfaceUrl(String statInterfaceUrl) {
		this.statInterfaceUrl = statInterfaceUrl;
	}

	public String getJifenUrl() {
		return jifenUrl;
	}

	public void setJifenUrl(String jifenUrl) {
		this.jifenUrl = jifenUrl;
	}

	public String getDingCanUrl() {
		return dingCanUrl;
	}

	public void setDingCanUrl(String dingCanUrl) {
		this.dingCanUrl = dingCanUrl;
	}

	public String getBesttoneSpId() {
		return besttoneSpId;
	}

	public void setBesttoneSpId(String besttoneSpId) {
		this.besttoneSpId = besttoneSpId;
	}

	public String getDomainName() {
		return domainName;
	}

	public void setDomainName(String domainName) {
		this.domainName = domainName;
	}

	public String getCustomerInfoUrl() {
		return customerInfoUrl;
	}

	public void setCustomerInfoUrl(String customerInfoUrl) {
		this.customerInfoUrl = customerInfoUrl;
	}

	public String getPasswordUrl() {
		return passwordUrl;
	}

	public void setPasswordUrl(String passwordUrl) {
		this.passwordUrl = passwordUrl;
	}

	public String getIndexTourLine() {
		return indexTourLine;
	}

	public void setIndexTourLine(String indexTourLine) {
		this.indexTourLine = indexTourLine;
	}

	public String getIndexTourLineUpload() {
		return indexTourLineUpload;
	}

	public void setIndexTourLineUpload(String indexTourLineUpload) {
		this.indexTourLineUpload = indexTourLineUpload;
	}

	public String getIndexTourLineServer() {
		return indexTourLineServer;
	}

	public void setIndexTourLineServer(String indexTourLineServer) {
		this.indexTourLineServer = indexTourLineServer;
	}

}
